home *** CD-ROM | disk | FTP | other *** search
- (******************************************************************************
- TIMERS.PAS - Routines which intercept 55ms PC interupt $1C to do timing
- Author - Richard Mullen
- Date - 10/20/90
- ******************************************************************************)
- {$R+} { Range checking on }
- {$B-} { Boolean complete evaluation off }
- {$S+} { Stack checking on }
- {$I-} { I/O checking off }
- {$V-} { Relaxed variable checking }
- {$N-} { No numeric coprocessor }
- {$E-} { No numeric coprocessor emulation }
-
- unit Timers;
-
- INTERFACE
-
- var
- TimerCounter : word;
-
- procedure InitTimerInterupt;
- procedure ReleaseTimerInterupt;
-
- IMPLEMENTATION
-
- uses dos;
-
- var
- OldVector : pointer;
-
- (*****************************************************************************)
-
- {$l timers}
- procedure CallRoutine (Vector : pointer); external;
-
- (*****************************************************************************)
-
- procedure TimerInterupt;
- interrupt;
- begin
-
- CallRoutine (OldVector); { Run old interupt routine }
-
- if TimerCounter > 0 then dec (TimerCounter); { TimerCounter is decremented }
- end; { every 55 ms, if not = 0 }
-
- (*****************************************************************************)
-
- procedure ReleaseTimerInterupt;
- begin
- inline ($FA);
- SetIntVec ($1C, OldVector);
- inline ($FB);
- end;
-
- (*****************************************************************************)
-
- procedure InitTimerInterupt;
- begin
- GetIntVec ($1C, OldVector);
- inline ($FA);
- SetIntVec ($1C, @TimerInterupt);
- inline ($FB);
- end;
-
- (*****************************************************************************)
- (************************ Initialization **********************************)
-
- begin
- TimerCounter := 0;
- end.
-